const express = require("express");
const tools = require("../../model/tools")


const router = express.Router()

router.get("/", (req, res) => {
  res.send("导航列表")
})

router.get("/add", (req, res) => {
  res.render("admin/nav/add")
})

router.get("/edit", (req, res) => {
  res.send("修改导航")
})
/**
* 实现多张图片上传
  let cpUpload = tools.multer().fields({ name: 'pic1', maxCount: 1 }, { name: 'pic2', maxCount: 1 })

  router.post("/doAdd", cpUpload, (req, res) => {
    res.send({
      body: req.body,
      file: req.file
    })
  })
 */

router.post("/doAdd", tools.multer().single("pic"), (req, res) => {
  res.send({
    body: req.body,
    file: req.file
  })
})

router.post("/doEdit", (req, res) => {
  res.send("执行修改")
})

module.exports = router